
#include "cube.h"

Cube :: Cube () : Polyhedra ()
{
	Cube (this->Size());
}

Cube :: Cube (float _size) : Polyhedra (_size)
{
	Cube (Size(), i, r);
}

Cube :: Cube (float _size, int _i, float _r)
	: Polyhedra (_size, _i, _r)
{
	num_pts = 8;
	p = new Point[num_pts];
	SetPoint (_size);
}

Cube :: ~Cube ()
{
	Polyhedra::~Polyhedra();
	if (p)
		delete p;
}

void Cube :: SetPoint (float _size)
{
	Polyhedra :: SetPoint (_size/2.0f);

	p[0].SetPoint (-size, -size, -size);
	p[1].SetPoint (size, -size, -size);
	p[2].SetPoint (size, -size, size);
	p[3].SetPoint (-size, -size, size);
	p[4].SetPoint (-size, size, size);
	p[5].SetPoint (size, size, -size);
	p[6].SetPoint (size, size, size);
	p[7].SetPoint (-size, size, -size);
}

void Cube :: _Draw (Point* pts)
{
	DrawFace (pts[0], pts[1], pts[2], pts[3]);
	DrawFace (pts[0], pts[3], pts[4], pts[7]);
	DrawFace (pts[3], pts[2], pts[6], pts[4]);
	DrawFace (pts[7], pts[4], pts[6], pts[5]);
	DrawFace (pts[1], pts[5], pts[6], pts[2]);
	DrawFace (pts[0], pts[7], pts[5], pts[1]);
}